// 基于准备好的dom，初始化echarts实例
var myChart = echarts.init(document.getElementById('main'));

function week() {
    $.post("/chart/week", function (chart) {
      var option = {
            title: {
                text: '进出货折线图'
            },
            tooltip: {
                trigger: 'axis'
            },
            legend: {
                data:['进货金额','销售金额']
            },
            xAxis: {
                type: 'category',
                data: chart.xDatas
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                name:'进货金额',
                data: chart.yInDatas,
                type: 'line',
                smooth: true,
                color: "green"
            }, {
                name:'销售金额',
                data: chart.yOutDatas,
                type: 'line',
                smooth: true,
                color: "red"
            }]
        };
        myChart.setOption(option);
    })
}
$(function () {
    week();
});